Patch from Matthias to add support for the _NET_WM_USER_TIME_WINDOW EWMH
authorElijah Newren <newren gmail com>
Sun, 1 Apr 2007 03:38:34 +0000 (03:38 +0000)
committerElijah Newren <newren@src.gnome.org>
Sun, 1 Apr 2007 03:38:34 +0000 (03:38 +0000)
2007-03-31  Elijah Newren  <newren gmail com>

* gdk/x11/gdkwindow-x11.c (setup_toplevel_window,
  gdk_x11_window_set_user_time):
Patch from Matthias to add support for the
_NET_WM_USER_TIME_WINDOW EWMH protocol; see #354213.

WARNING: This patch will make metacity <= 2.18.0 freeze on
workspace switch.  This is due to a weird problem that should only
affect window managers using gdk in-process for decoration drawing
and which make an unsafe assumption relating to doing so (i.e. it
should only affect metacity).  Upgrade your version of metacity if
you hit this bug.

svn path=/trunk/; revision=17574

ChangeLog
gdk/x11/gdkwindow-x11.c

index cd0da1c29a34e3767802bf6f2edbf958174957b1..7df72a3599101eda2cdc9843b38e17662d282c18 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2007-03-31  Elijah Newren  <newren gmail com>
+
+       * gdk/x11/gdkwindow-x11.c (setup_toplevel_window,
+         gdk_x11_window_set_user_time):
+       Patch from Matthias to add support for the
+       _NET_WM_USER_TIME_WINDOW EWMH protocol; see #354213.
+
+       WARNING: This patch will make metacity <= 2.18.0 freeze on
+       workspace switch.  This is due to a weird problem that should only
+       affect window managers using gdk in-process for decoration drawing
+       and which make an unsafe assumption relating to doing so (i.e. it
+       should only affect metacity).  Upgrade your version of metacity if
+       you hit this bug.
+
 2007-03-29  Michael Natterer  <mitch@imendio.com>
 
        Don't close menus on clicks on their border area (bug #423761).
index c0226a6815994046cd0430fd05f46d0cce46ba52..533387fc6f0b66313c30f3ec45da6d1cba981cf1 100644 (file)
@@ -614,6 +614,12 @@ setup_toplevel_window (GdkWindow *window,
                   XA_WINDOW, 32, PropModeReplace,
                   (guchar *) &GDK_DISPLAY_X11 (screen_x11->display)->leader_window, 1);
 
+  if (toplevel->focus_window != None)
+    XChangeProperty (xdisplay, xid, 
+                     gdk_x11_get_xatom_by_name_for_display (screen_x11->display, "_NET_WM_USER_TIME_WINDOW"),
+                     XA_WINDOW, 32, PropModeReplace,
+                     (guchar *) &toplevel->focus_window, 1);
+
   if (!obj->focus_on_map)
     gdk_x11_window_set_user_time (window, 0);
   else if (GDK_DISPLAY_X11 (screen_x11->display)->user_time != 0)
@@ -4256,6 +4262,7 @@ gdk_x11_window_set_user_time (GdkWindow *window,
   GdkDisplayX11 *display_x11;
   GdkToplevelX11 *toplevel;
   glong timestamp_long = (glong)timestamp;
+  Window xid;
 
   g_return_if_fail (GDK_IS_WINDOW (window));
 
@@ -4266,7 +4273,20 @@ gdk_x11_window_set_user_time (GdkWindow *window,
   display_x11 = GDK_DISPLAY_X11 (display);
   toplevel = _gdk_x11_window_get_toplevel (window);
 
-  XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
+  if (!toplevel)
+    {
+      g_warning ("gdk_window_set_user_time called on non-toplevel\n");
+      return;
+    }
+
+  if (toplevel->focus_window != None &&
+      gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
+                                           gdk_atom_intern_static_string ("_NET_WM_USER_TIME_WINDOW")))
+    xid = toplevel->focus_window;
+  else
+    xid = GDK_WINDOW_XID (window);
+
+  XChangeProperty (GDK_DISPLAY_XDISPLAY (display), xid,
                    gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_USER_TIME"),
                    XA_CARDINAL, 32, PropModeReplace,
                    (guchar *)&timestamp_long, 1);